import Vue from 'vue'
import NotificationInfo from './KendoNotifyInfo.vue'

const Notification = Vue.extend(NotificationInfo)

NotificationInfo.install = function(options, type) {
  if (options === undefined || options === null) {
    options = {
      title: '',
      message: ''
    }
  } else if (typeof options === 'string' || typeof options === 'number') {
    options = {
      content: options
    }
    if (type !== undefined && options !== null) {
      options.type = type
    }
  }

  const instance = new Notification({
    data: options
  }).$mount()
  if (type === 'warning') {
    instance.notification.warning(options)
  }
  if (type === 'error') {
    instance.notification.error(options)
  }
  if (type === 'success') {
    instance.notification.success(options)
  }
}
export default NotificationInfo
